Towards Certified Meta-Programming with Typed Template-Coq
نویسندگان
چکیده
Template-Coq is a plugin for Coq, originally implemented by Malecha [17], which provides a reifier for Coq terms and global declarations, as represented in the Coq kernel, as well as a denotation command. Initially, it was developed for the purpose of writing functions on Coq’s AST in Gallina. Recently, it was used in the CertiCoq certified compiler project [4], as its front-end language, to derive parametricity properties [3], and to extract Coq terms to a CBV λ-calculus [13]. However, the syntax lacked semantics, be it typing semantics or operational semantics, which should reflect, as formal specifications in Coq, the semantics of Coq’s type theory itself. The tool was also rather bare bones, providing only rudimentary quoting and unquoting commands. We generalize it to handle the entire Calculus of Inductive Constructions (CIC), as implemented by Coq, including the kernel’s declaration structures for definitions and inductives, and implement a monad for general manipulation of Coq’s logical environment. We demonstrate how this setup allows Coq users to define many kinds of general purpose plugins, whose correctness can be readily proved in the system itself, and that can be run efficiently after extraction. We give a few examples of implemented plugins, including a parametricity translation. We also advocate the use of Template-Coq as a foundation for higher-level tools.
منابع مشابه
Mechanized Reasoning for Binding Constructs in Typed Assembly Language Using Coq
Mechanized reasoning about programming languages and type systems is becoming increasingly important for the development of certified code frameworks. For instance, in order to realize the safety and security potential of proof-carrying code (PCC) [3] the development of formal, machine-checkable proofs is a necessity. Much of the difficulty and research surrounding PCC involves the generation o...
متن کاملInitial Semantics for higher-order typed syntax
We present an initial semantics result for typed higher-order syntax based on monads and modules over monads. The notion of module generalizes the substitution structure of monads. For a simply typed binding signature S we define a representation of S to be a monad equipped with a morphism of modules for each of its arities. The monad of abstract syntax of S then is the initial object in the ca...
متن کاملDeveloping Certified Program Verifiers with a Proof Assistant
I describe ongoing work on a new approach to foundational proof-carrying code. The key new idea is to use certified program verifiers to embody customized program verification strategies, specialized to particular safety policies, enforcement mechanisms, and source-level compilers. A certified verifier is an executable program that has a full correctness proof. The particular strategy that I’ve...
متن کاملλ-Types on the λ-Calculus with Abbreviations: a Certified Specification
In this paper the author presents λδ, a λ-typed λ-calculus with a single λ binder and abbreviations. The formal properties of λδ, that include the standard requirements for a typed λ-calculus, have been certified by the author with the proof assistant COQ. The presentation focuses on motivating the calculus and the corpus of definitions on which its specification in COQ is based.
متن کاملPosition Paper: Thoughts on Programming with Proof Assistants
Today the reigning opinion about computer proof assistants based on constructive logic (even from some of the developers of these tools!) is that, while they are very helpful for doing math, they are an absurdly heavy-weight solution to use for practical programming. Yet the Curry-Howard isomorphism foundation of proof assistants like Coq [BC04] gives them clear interpretations as programming e...
متن کامل